<template>
	<view class="box">
		<image :src="item" mode="aspectFill" @click="ClickImage(item)" />
	</view>
</template>

<script lang="ts" setup>
	import { onLoad, onUnload, onReachBottom, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app"

	const props = defineProps(['item'])

	onLoad((e) => {
		console.log(e, decodeURIComponent(props.item))
		decodeURIComponent(props.item)
	})


	const ClickImage = (imageUrl) => {
		uni.previewImage({
			urls: [imageUrl],
			longPressActions: {
				itemList: ['发送给朋友', '保存图片', '收藏'],
				success: function (data) {
					console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
				},
				fail: function (err) {
					console.log(err.errMsg);
				}
			}
		});
	}
</script>

<style lang="scss" scoped>
	.box {
		width: 200rpx;
		height: 200rpx;
		// height: 200rpx;
		// border: 1px solid red;
		padding: 5rpx;

		image {
			width: 100%;
			height: 100%;

		}
	}
</style>